window.onload=function(){
  //订单填写页面 号码处理
  //var oReceivingTel=document.getElementById("receivingTel");
  var oReceivingTel=document.getElementsByClassName("receivingTel");
  for(var i=0;i<oReceivingTel.length;i++){
  	var oNum=oReceivingTel[i].innerHTML; 
  	oReceivingTel[i].innerHTML=splitNum(oNum);
  }
  

var touchstart=function(event){
    console.log("1:"+touchstart);
        event.preventDefault();
        iScoll=event.changedTouches[0].pageX;
  };
  var touchmove=function(event){
    event.preventDefault();
      moveX=event.changedTouches[0].pageX-iScoll;
      if(moveX>0){
          this.style.WebkitTransform = "translateX(" + 0 + "px)";
      }
      else if(moveX<0){

        var l=Math.abs(moveX)
        this.style.WebkitTransform = "translateX(" + -l + "px)";
        if(l>240){
          l=240;
          this.style.WebkitTransform = "translateX(" + -l + "px)";
        }
      }
      
  };
  var touchend=function(event){
    event.preventDefault();
    moveX=event.changedTouches[0].pageX-iScoll;
    if(moveX>-120){
      var l=0;
      this.style.WebkitTransform = "translateX(" + -l + "px)";
    }
    else{
      l=240;
      this.style.WebkitTransform = "translateX(" + -l + "px)";
    }

        // this.removeEventListener("touchstart",touchstart,false);
        // this.removeEventListener("touchmove",touchmove,false);
        // this.removeEventListener("touchend",touchend,false);
  };


//地址列表
  var iScoll=0;
  var moveX=0;
	var oAddressList=document.getElementsByClassName("addressEditable");
    for(var i=0;i<oAddressList.length;i++){
      var temp=oAddressList[i];

/*  temp.onclick=function(){
   this.style.WebkitTransform = "translateX(" + 0 + "px)";
   this.style.transition="0.3s";

  }*/

  temp.addEventListener("touchstart",touchstart,false);
	temp.addEventListener("touchmove",touchmove,false);
	temp.addEventListener("touchend",touchend,false);
}

var onOff=true;
$(document).ready(function(){
  $(".payNotes").click(function(){
     if(onOff){
     	$(".payChoose").removeClass('payChoose01').addClass('payChoose02')
     }
     else{
        $(".payChoose").removeClass('payChoose02').addClass('payChoose')
     }
     onOff=!onOff;
    $(".chooseList").slideToggle("slow");
  });

  $(".delete01").on("click",function(){
    $(this).parent().parent().remove();
  })
});
 // var ace=document.getElementById("ack");
/*  ace.addEventListener("click",function(){
    e.preventDefault();
    //alert(1)
  })*/
  //ace.preventDefault();
   //订单填写页
  
/*	var oPurchaseNum=document.getElementById("contentList");
	var oSub=oPurchaseNum.getElementsByClassName("listInfo");
	var oPrice=oPurchaseNum.getElementsByClassName("presentPrice");
	var OriginalPrice=oPurchaseNum.getElementsByClassName("originalPrice");
	var oNum=oPurchaseNum.getElementsByClassName("numOf");
	var oAll=document.getElementById("sumAll");
	var oBreaks=document.getElementById("breaks");
    function fn(){
    	var oSumAll=0;
    	for(var i=0;i<oSub.length;i++){
    		oSumAll = oSumAll +parseInt(oPrice[i].innerHTML)*oNum[i].innerHTML.slice(1);
    	}
    	oAll.innerHTML="￥"+parseFloat(oSumAll);
    }
   fn();
    function preMonery(){
    	var oPreMonery=0;
    	for(var i=0;i<oSub.length;i++){
    		oPreMonery = oPreMonery+parseInt(OriginalPrice[i].innerHTML)*oNum[i].innerHTML.slice(1);
    	}
    	oBreaks.innerHTML="￥"+parseFloat(oPreMonery);

    }
    preMonery();*/
}

//订单填写页面 号码处理
  function splitNum(str){
             var newStr=str.slice(0,3)+" "+str.slice(3,7)+" "+str.slice(7);
             return newStr
  }

